<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Nova Instituição/Orgão</h2>
            <h:form id="form" acceptcharset="utf-8">
                <p:growl id="msg" life="3000"/>
                <p:panel  styleClass="container_24 clearfix " style="background: none; border: none;">
                    <p class="subtitle">Dados </p>
                    <p:outputLabel value="Nome :" for="name" styleClass="grid_3"/>
                    <p:inputText  required="true" value="#{managerCreateOrgan.organ.name}" id="name" styleClass="grid_18"/>
                    <p:outputLabel value="Vara :" for="vara" styleClass="grid_3"/>
                    <p:inputText  required="true" id="vara" value="#{managerCreateOrgan.organ.vara}" styleClass="grid_18"/>
                    <p:outputLabel for="city" value="Cidade :" styleClass="grid_3"/>
                    <div class="grid_7">
                        <p:autoComplete  value="#{managerCreateOrgan.city}" completeMethod="#{managerCreateAddress.completeCity}"   
                                         var="city" id="city" required="true" requiredMessage="O Campo Cidade deve ser preenchido"
                                         itemLabel="#{city.name} #{city.states.sgl}" itemValue="#{city}" converter="cityConverter" 
                                         forceSelection="true" converterMessage="Erro, verifique a cidade" minQueryLength="3"
                                         maxResults="10"  dropdown="true"> 
                        </p:autoComplete>
                    </div>

                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Salvar" icon="ui-icon-disk"        styleClass="ui-priority-primary"                                  
                                         actionListener="#{managerCreateOrgan.save()}" update="msg, @form"/>
                        <p:commandButton value="Cancelar" icon="ui-icon-close" 
                                         actionListener="#{managerRedirect.redirect('indexOrgan.xhtml')}" immediate="true"/>
                    </div>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>


